/* ESP32开发工具样式表 */

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1f2937;
}

::-webkit-scrollbar-thumb {
    background: #4f46e5;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6366f1;
}

/* 树形结构样式 */
.tree, .tree ul, .tree li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tree li {
    padding: 5px 0 5px 20px;
    position: relative;
    transition: background-color 0.2s;
}

.tree li:before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 15px;
    height: 1.5em;
    border-left: 1px solid #6b7280;
    border-bottom: 1px solid #6b7280;
}

.tree li:after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 15px;
    height: 100%;
    border-left: 1px solid #6b7280;
}

.tree li:last-child:after {
    display: none;
}

.tree > li:first-child:before {
    border-left: none;
}

.tree > li:first-child:after {
    border-left: none;
}

.tree li:hover {
    background-color: #374151;
    border-radius: 3px;
}

/* 引脚配置面板 */
.pin-config-panel {
    animation: modalAppear 0.3s ease-out;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.pin-config-overlay {
    animation: overlayAppear 0.3s ease-out;
}

@keyframes overlayAppear {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 连接状态指示器 */
.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-connected {
    background-color: #10B981;
    box-shadow: 0 0 8px #10B981;
}

.status-disconnected {
    background-color: #9CA3AF;
}

/* 引脚配置样式 */
.pin-item {
    transition: all 0.2s ease;
    cursor: pointer;
}

.pin-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.pin-configured {
    border-color: #8b5cf6;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

/* 代码标签页 */
.tab-btn {
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

.tab-btn:hover:not(.active) {
    background: #374151;
}

/* 按钮悬停效果 */
button {
    transition: all 0.2s ease;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 进度条动画 */
.progress-bar {
    transition: width 0.3s ease;
}

/* 卡片悬停效果 */
.bg-gray-800 {
    transition: all 0.3s ease;
}

.bg-gray-800:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* 串口监视器 */
#serial-monitor p {
    margin: 0;
    line-height: 1.4;
}

.serial-message {
    color: #d1d5db;
}

.serial-error {
    color: #f87171;
}

.serial-info {
    color: #60a5fa;
}

.serial-success {
    color: #34d399;
}

/* 响应式设计优化 */
@media (max-width: 1024px) {
    .container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    #pin-configuration {
        min-height: 150px;
    }
}

@media (max-width: 768px) {
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .grid-cols-4 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    #code-preview {
        max-height: 300px;
    }
}

@media (max-width: 480px) {
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    .p-6 {
        padding: 1rem;
    }
}

/* 代码预览区域优化 */
#code-preview {
    min-height: 250px;
}

#code-preview pre {
    margin: 0;
    border-radius: 0;
    height: 100%;
}

/* 渐变边框效果 */
.border-gradient {
    position: relative;
    border: none;
    background: linear-gradient(135deg, #1f2937, #111827) padding-box,
                linear-gradient(135deg, #4f46e5, #7c3aed) border-box;
    border-width: 2px;
    border-style: solid;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 脉冲动画 */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(79, 70, 229, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0);
    }
}